/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gameheart.transport;

import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;

/**
 *
 * @author win7
 */
public class Command {

    private int commandId;

    /**
     * @return the commandId
     */
    public int getCommandId() {
        return commandId;
    }
    /**
     * @param commandId the commandId to set
     */
    public void setCommandId(int commandId) {
        this.commandId = commandId;
    }
//    private Element argElement;
//
//    /**
//     * @return the argElement
//     */
//    public Element getArgElement() {
//        return argElement;
//    }
//
//    /**
//     * @param argElement the argElement to set
//     */
//    public void setArgElement(Element argElement) {
//        this.argElement = argElement;
//    }
    private String[] argNames;
    private String[] argdValues;
    private int argNumber = -1;

    /**
     * @return the argNames
     */
    public String[] getArgNames() {
        return argNames;
    }

    /**
     * @param argNames the argNames to set
     */
    public void setArgNames(String[] argNames) {
        this.argNames = argNames;
    }

    /**
     * @return the argdValues
     */
    public String[] getArgdValues() {
        return argdValues;
    }

    /**
     * @param argdValues the argdValues to set
     */
    public void setArgdValues(String[] argdValues) {
        this.argdValues = argdValues;
    }

    /**
     * @return the argNumber
     */
    public int getArgNumber() {
        return argNumber;
    }

    /**
     * @param argNumber the argNumber to set
     */
    public void setArgNumber(int argNumber) {
        this.argNumber = argNumber;
    }

    public String getValueOfArg(String argName) {
        String value = null;
        for (int index = 0; index < argNumber; ++index) {
            if (argNames[index].compareTo(argName) == 0) {
                value = argdValues[index];
                break;
            }
        }
        return value;
    }
    public String[] getValuesOfArg(String argName)
    {
        List<String> value = new ArrayList<String>();
        for (int index = 0; index < argNumber; ++index) {
            if (argNames[index].compareTo(argName) == 0) {
                value.add( argdValues[index]);
            }
        }
        String[] result = new String[value.size()];
        return value.toArray(result);
    }
}
